﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FieldManage.aspx.cs" Inherits="Whir_System_Module_CommonModel_FieldManage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>字段管理</title>
    <link href="../../Skin/Default/Css/main.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript">
        if (top.location == self.location) { 
            alert('禁止访问子栏目页！将跳转到默认页面');
            top.location='../../Default.aspx';
        } 
    </script>

    <!--提示文字-->

    <script src="../../Js/common.js" type="text/javascript"></script>

    <script language="javascript">
        showhint('1','<b>字段的概念</b><br/>字段对应的就是数据库中的字段，标识为“系统”级别的字段为不可删除、不可修改。<br/>“排序”的作用是后台栏目添加、修改页中的排序。');
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="fieldID"
            OnRowCommand="GridView1_RowCommand" Width="99%">
            <HeaderStyle CssClass="grid_Title" Height="20px" />
            <RowStyle CssClass="grid_td" Height="23px" HorizontalAlign="Center" />
            <Columns>
                <asp:BoundField DataField="fieldID" HeaderText="ID">
                    <HeaderStyle CssClass="grid_Title" />
                </asp:BoundField>
                <asp:BoundField DataField="fieldName" HeaderText="数据库字段名">
                    <HeaderStyle CssClass="grid_Title" />
                </asp:BoundField>
                <asp:BoundField DataField="alias" HeaderText="字段别名">
                    <HeaderStyle CssClass="grid_Title" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="字段类型">
                    <ItemTemplate>
                        <%# FieldTypeDesc(Eval("fieldType"))%>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid_Title" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="字段级别">
                    <ItemTemplate>
                        <%# (bool)Eval("rating")? "自定义" : "<span style='color:Green'>系统</span>"%>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid_Title" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="必填">
                    <ItemTemplate>
                        <%# (bool)Eval("isRequired") ? "<B><span style='color:#000000'>√</span></B>" : "<B><span style='color:Red'>×</span></B>"%>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid_Title" />
                </asp:TemplateField>
                <%--<asp:TemplateField HeaderText="启用">
                    <ItemTemplate>
                        <%# (bool)Eval("isUse") ? "<B><span style='color:#000000'>√</span></B>" : "<B><span style='color:Red'>×</span></B>"%>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid_Title" />
                </asp:TemplateField>--%>
                <asp:TemplateField HeaderText="排序">
                    <ItemTemplate>
                        <asp:DropDownList ID="ddlSortIndex" runat="server">
                        </asp:DropDownList>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid_Title" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="管理操作">
                    <ItemTemplate>
                        <a href='<%# "Field.aspx?Action=Modify&ModelID=" + Request.QueryString["ModelID"] +"&FieldID="+ Eval("fieldID") +"&FieldName="+Server.UrlEncode(Eval("FieldName").ToString())%>'
                            title="字段修改">
                            <img src="../../image/CommonImage/eip_edit.gif" style="border: 0px;" /></a>
                        <asp:ImageButton ID="ImageButton1" runat="server" OnClientClick="if(!this.disabled) return confirm('删除字段将删除对应表中所有该字段的数据，是否删除该字段？');"
                            CommandName="DeleteField" CommandArgument='<%# Eval("FieldID")%>' Enabled='<%# (bool)Eval("rating")? true:false%>'
                            ImageUrl="~/Whir_System/image/CommonImage/eip_deleted.gif" ToolTip='<%# (bool)Eval("rating")? "字段删除":"当前是系统字段，不能删除"%>' />
                        <%-- <asp:LinkButton runat="server" ID="ELbtnDisabled" Text='<%# (bool)Eval("isUse") ? "禁用" : "启用"%>'
                            CommandName='<%# (bool)Eval("isUse") ? "Disabled" : "Enabled"%>' CommandArgument='<%# Eval("fieldID")%>'
                            Enabled='<%# (bool)Eval("rating")? true:false%>' />--%>
                    </ItemTemplate>
                    <HeaderStyle CssClass="grid_Title" />
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <div class="command">
            <asp:Button ID="EBtnSubmit" runat="server" OnClick="EBtnSubmit_Click" Text="添加字段"
                CssClass="btn_default" />
            <asp:Button ID="btnSave" runat="server" Text="保存排序" CssClass="btn_default" OnClick="btnSave_Click" />
            <asp:Button ID="btnCancel" runat="server" Text="返回" CssClass="btn_default" CausesValidation="False"
                OnClick="btnCancel_Click" /></div>
    </form>
</body>
</html>
